+
+# If you do not have libexpat and you have no use for reading any input
+# type that is XML-ish (i.e. gpx or geocaching.com's/loc) you can uncomment
+# INHIBIT_EXPAT and coment out LIBEXPAT on just to get a build working quickly.
+# INHIBIT_EXPAT=-DNO_EXPAT
+LIBEXPAT=-lexpat
+
# add -DDEBUG_MEM to turn on memory allocation logging
-CFLAGS=$(EXTRA_CFLAGS) -g -Icoldsync
+CFLAGS=$(EXTRA_CFLAGS) -g -Icoldsync $(INHIBIT_EXPAT)
INSTALL_TARGETDIR=/usr/local/
FMTS=magproto.o gpx.o geo.o mapsend.o mapsource.o \
all: gpsbabel
gpsbabel: $(OBJS)
- $(CC) $(CFLAGS) $(OBJS) -o gpsbabel -lexpat -lm
+ $(CC) $(CFLAGS) $(OBJS) -o gpsbabel $(LIBEXPAT) -lm
main.o:
$(CC) -c $(CFLAGS) -DVERSION=\"$(VERSIOND)\" $<
*/
#include "defs.h"
+#if !NO_EXPAT
#include <expat.h>
+static XML_Parser psr;
+#endif
static int in_wpt;
static int in_name;
static char *cdatastr;
static char *typestr;
-static XML_Parser psr;
static waypoint *wpt_tmp;
FILE *fd;
#define MYNAME "geo"
#define MY_CBUF 4096
+#if NO_EXPAT
+void
+geo_rd_init(const char *fname, const char *args)
+{
+ fatal(MYNAME ": This build excluded GPX support becuase expat was not installed.\n");
+}
+
+void
+geo_read(void)
+{
+}
+#else
static void
tag_coord(const char **attrv)
{
XML_SetCharacterDataHandler(psr, geo_cdata);
}
+void
+geo_read(void)
+{
+ int len;
+ char buf[MY_CBUF];
+
+ while ((len = fread(buf, 1, sizeof(buf), fd))) {
+ if (!XML_Parse(psr, buf, len, feof(fd))) {
+ fatal(MYNAME ":Parse error at %d: %s\n",
+ XML_GetCurrentLineNumber(psr),
+ XML_ErrorString(XML_GetErrorCode(psr)));
+ }
+ }
+
+ XML_ParserFree(psr);
+}
+
+#endif
+
void
geo_rd_deinit(void)
{
fclose(ofd);
}
-void
-geo_read(void)
-{
- int len;
- char buf[MY_CBUF];
-
- while ((len = fread(buf, 1, sizeof(buf), fd))) {
- if (!XML_Parse(psr, buf, len, feof(fd))) {
- fatal(MYNAME ":Parse error at %d: %s\n",
- XML_GetCurrentLineNumber(psr),
- XML_ErrorString(XML_GetErrorCode(psr)));
- }
- }
-
- XML_ParserFree(psr);
-}
-
static void
geo_waypt_pr(const waypoint *waypointp)
{
*/
#include "defs.h"
-#include <expat.h>
+#ifndef NO_EXPAT
+ #include <expat.h>
+ static XML_Parser psr;
+#endif
static int in_wpt;
static int in_rte;
static int opt_logpoint = 0;
static int logpoint_ct = 0;
-static XML_Parser psr;
-
static const char *gpx_version;
static const char *gpx_creator;
}
}
+#if NO_EXPAT
+void
+gpx_rd_init(const char *fname, const char *args)
+{
+ fatal(MYNAME ": This build excluded GPX support becuase expat was not installed.\n");
+}
+
+#else /* NO_EXPAT */
+
static void
gpx_cdata(void *dta, const XML_Char *s, int len)
{
XML_SetElementHandler(psr, gpx_start, gpx_end);
XML_SetCharacterDataHandler(psr, gpx_cdata);
}
+#endif
static void
gpx_rd_deinit(void)
void
gpx_read(void)
{
+#ifndef NO_EXPAT
int len;
int done = 0;
char buf[MY_CBUF];
XML_ErrorString(XML_GetErrorCode(psr)));
}
}
+#endif /* NO_EXPAT */
}
/*